home *** CD-ROM | disk | FTP | other *** search
- Path: shark.sb.grci.com!usenet
- From: "Howard S. Ostrowsky" <shermo@sb.grci.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Borland Addition
- Date: 15 Feb 1996 17:22:12 GMT
- Organization: GRC International, Inc.
- Message-ID: <4fvq44$ien@shark.sb.grci.com>
- References: <2d7cc$14c35.82@NEWS> <4ft9m5$fsr@netnews.upenn.edu>
- NNTP-Posting-Host: sherm.sb.grci.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
-
- modavis@ssc.sas.upenn.edu (Morris A. Davis) wrote:
- >Gooseman () wrote:
- >: I just saw an interesting bug in "Windows Developer" magazine (I think
- >: that's the title).
- >
- >: #include <iostream.h>
- >: int main()
- >: {
- >: int i = 1;
- >: int j = 1;
- >
- >: if(i)
- >: i = i + 4;
- >: else
- >: i = j + 4;
- >
- >: cout << i;
- >: }
- >
- >: You would expect the output to be 5, but the result will be 9! I
- >: tried this under 4.52 and 4.0 and both produced the same results.
- >
-
- This may be a problem with the optimizer; if you compile with optimization
- turned off, the bug does not appear.
-
- Sherm Ostrowsky
-
-